package com.m7.yiduzw.cms.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.m7.yiduzw.cms.service.TestService;
import com.m7.yiduzw.vo.TestVo;

/**
 * @Description:用于测试框架的controller 接受参数 传递结果 千万不要做业务
 * @date 2013-9-10 下午02:19:43
 * @author ZhouFeng
 */

@Controller
@RequestMapping("/cms/test")
public class TestController {

	@Autowired
	private TestService testService;

	@RequestMapping(value = "/insert")
	public String save(TestVo testVo) {

		testService.saveTest(testVo);
		return "redirect:/cms/test/list";

	}

	@RequestMapping(value = "/delete")
	public String delete(String testId) {

		testService.deleteTest(testId);
		return "redirect:/cms/test/list";
	}

	@RequestMapping(value = "/list")
	public ModelAndView list(ModelAndView model, TestVo testVo) {

		model.addObject("testVoList", testService.selectTest());
		model.setViewName("/test/test_list");
		return model;
	}

	@RequestMapping(value = "/add")
	public String add() {

		return "/test/test_add";

	}

}